<template>
    <div class="dlIndex">
        <div class="member-main">
            <a>
                <div class="member-list border-top">
                    <div class="list-left2">
                        <img :src="strImg" id="imgFace"><em id="emRealName"></em>
                    </div>
                    <a class="list-right2" href="/vue/center/member-setup-tx">
                        <span>修改头像</span>
                    </a>
                </div>
            </a>

            <router-link :to="{name:'DlSeller',params:{state:'publish'}}">
                <div class="member-list border-top margin-top">
                    <div class="list-left">
                        <em>我是玩家</em>
                    </div>
                    <div class="list-right">
                        <span></span>
                    </div>
                </div>
            </router-link>
            <router-link id="isDashou" :to="{name:'DlDaShou',params:{state:'publish'}}">
                <div class="member-list ">
                    <div class="list-left">
                        <em>我是打手</em>
                    </div>
                    <div class="list-right">
                        <span></span>
                    </div>
                </div>
            </router-link>
            <router-link v-if="showStore" :to="{name:'DlMyStore',params:{state:'publish'}}">
                <div class="member-list ">
                    <div class="list-left">
                        <em>我的店铺</em>
                    </div>
                    <div class="list-right">
                        <span></span>
                    </div>
                </div>
            </router-link>
            <div id="kf2" class="kf2" @click="goToServe(2248700294)">
                <a href="javascript:"><img src="~images/kf2.png" width="100%"></a>
            </div>

        </div>
    </div>
</template>

<script>
    export default {
        name: 'DlMyCenter',
        data () {
            return {
                showStore: false,
                strImg:''
            }

        },
        methods: {
            goToServe(qq){
                if (/baidu/i.test(navigator.userAgent.toLowerCase())) {
                    alert('"联系客服"暂不支持当前浏览器，建议使用QQ浏览器、UC浏览器')
                } else {
                    location.href = 'mqqwpa://im/chat?chat_type=wpa&uin=' + qq + '&version=1&src_type=web&web_src=oicqzone.com'
                }
            },
        },
        created(){
            this.$http.post(this.$CONSTANTS.P30006 + "account/queryCurrentUserInfo", {}).then((res) => {
                if (res.body.responseStatus.code == "00" && res.body.userInfo != null) {
                    var hatchetManStatus = res.body.userInfo.hatchetManStatus + '';
                     this.strImg = res.body.userInfo.avatarUrl
                    if (hatchetManStatus.trim().length == 0 || hatchetManStatus != "2") {
                        this.$router.push({
                          name:'DlSeller',params:{state:'publish'}
                        })
                    } else {
                        this.$http.get(this.$CONSTANTS.APIStore + "storeService/queryStoreByUser", {
                            params: {},
                        }).then((resp) => {
                            this.showStore = false
                            if (resp.body.responseStatus.code == "00" && resp.body.result != null) {
                                console.log("--------", resp)

                                var storeStatus = resp.body.result.storeStatus + '';
                                if (storeStatus.trim().length != 0 && (storeStatus == "3" || storeStatus == "5")) {
                                    this.showStore = true
                                }
                            }
                        })
                    }


                }

                this.topName = res.result
            }, (res) => {

            });
        },
        mounted(){
            var self = this;
            console.log(this.topName)
            this.$bus.emit('headerText', "我的代练");
            self.$bus.emit('isMore', false);


        },
        destroyed(){
            var self = this;
            self.$bus.emit('headerText', '');
            self.$bus.emit('isMore', false);
        }
    }
</script>


<style scoped>
    .dlIndex {
        margin-top: .96rem;
    }
</style>
